<template>
  <div id="home_app">
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="panel" style="width: 100%; height: 500px"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  mounted() {
    this.draw_line();
  },
  methods: {
    draw_line() {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.querySelector("#panel"));

      // 指定图表的配置项和数据
     var option = {
        xAxis: {
          name:'年度/年',
          type: "category",
          data: ["2016", "2017","2018", "2019", "2020", "2021"],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            name:'销售额',
            data: [2000, 3000, 5266, 6545, 10843, 12000],
            type: "line",
          },
        ],
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    },
  },
};
</script>

<style>
</style>